package com.cosina.game.crystallight.model.battle;

import java.util.Random;

public class Tile {
	
	public static final int ROAD_S_2_E = 0;
	public static final int ROAD_S_2_W = 1;
	public static final int ROAD_N_2_W = 2;
	public static final int ROAD_N_2_E = 3;
	public static final int ROAD_N_2_S = 4;
	//5
	public static final int ROAD_W_2_E = 6;
	//7
	public static final int GROUND_A = 8;
	public static final int GROUND_B = 9;
	public static final int GROUND_C = 10;
	public static final int GROUND_D = 11;
	public static final int GROUND_E = 12;
	public static final int GROUND_F = 13;
	public static final int GROUND_G = 14;
	public static final int GROUND_H = 15;
	
	private static Random random = new Random();
	public static int getRandomGround(){
		if(random.nextInt(4)==1){
			return random.nextInt(8) + 8;
		}else{
			return GROUND_A;
		}
	}
	
	
	public static int getTileType(boolean leftIsRoad,boolean topIsRoad,boolean rightIsRoad,boolean downIsRoad){
		if(leftIsRoad && topIsRoad){
			return ROAD_N_2_W;
		}
		if(leftIsRoad && rightIsRoad){
			return ROAD_W_2_E;
		}
		if(leftIsRoad && downIsRoad){
			return ROAD_S_2_W;
		}
		if(topIsRoad && downIsRoad){
			return ROAD_N_2_S;
		}
		if(topIsRoad && rightIsRoad){
			return ROAD_N_2_E;
		}
		if(downIsRoad && rightIsRoad){
			return ROAD_S_2_E;
		}
		return -1;
	}
}
